package com.eddie.memento;

/**
 * @author Eddie
 * @date 2022/08/04 12:02
 **/
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        Caretaker caretaker = new Caretaker();


        originator.setState("#状态1 攻击力 100");

        //保存了当前的状态
        caretaker.add(originator.saveStateMemento());

        originator.setState("#状态2 攻击类 80");

        caretaker.add(originator.saveStateMemento());

        System.out.println("当前的状态是="+originator.getState());

        //恢复到状态1
        System.out.println("······················希望得到状态1······················");
        originator.getStateFromMemento(caretaker.get(0));
        System.out.println("当前的状态是="+originator.getState());
    }
}
